<template>
  <div>
    <van-nav-bar
      title="标题"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <img :src=" musicInfo.albumPicUrl" alt="" class="ig" />
    <p>专辑：{{  musicInfo.albumName }}</p>
    <p>艺术家：{{  musicInfo.artistName }}</p>
    <audio :src=" musicInfo.musicMp3Url" controls></audio>
  </div>
</template>
<script>
import url from "../tools/url";
export default {
  name: "Swipdetail",
  data() {
    return {
     musicInfo: {},
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
  },
  mounted() {
    var id = this.$route.query.musicId;
    var token = sessionStorage.getItem("token");
    var str = `token=${token}&musicId=${id}`;
    this.axios.post(url.FINDMUSICBYID, str).then((res) => {
      console.log(res);
      if (res.data.code == 200) {
        this.musicInfo = res.data.data;
      } else {
        this.$router.push("/Login").catch((e) => {});
      }
    });
  },
};
</script>
<style scoped>
.ig {
  width: 100%;
}
</style>
